package com.yykj.prescription.server.converter;

import com.yykj.prescription.client.dto.PrescriptionDrugWestDTO;
import com.yykj.prescription.server.model.entity.prescription.PrescriptionDrugWest;
import org.springframework.beans.BeanUtils;

import java.util.List;
import java.util.stream.Collectors;

public class PrescriptionDrugWestDTOConverter {
    public static PrescriptionDrugWestDTO convert(PrescriptionDrugWest item){
        PrescriptionDrugWestDTO dto = new PrescriptionDrugWestDTO();
        BeanUtils.copyProperties(item,dto);
        return dto;
    }
    public static List<PrescriptionDrugWestDTO> convert(List<PrescriptionDrugWest> itemList){
        return itemList.stream().map(PrescriptionDrugWestDTOConverter::convert).collect(Collectors.toList());
    }
}
